Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: golang attestor #426

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

feat: golang attestor #426

wants to merge 3 commits into from

Conversation

ChaosInTheCRD
Copy link
Collaborator

What this PR does / why we need it

This PR introduces a golang attestor (requires go 1.24) which produces a structured golang attestation for the output of go test. Specifically, this attestor leverages the -json output supported in Go 1.24 if it is written to a file (e.g., go test -json -v -cover ./... > go.json) and can also leverage code coverage statements (reporting percentage coverage) if -cover is specified.

Acceptance Criteria Met

  • Docs changes if needed
  • Testing changes if needed
  • All workflow checks passing (automatically enforced)
  • All review conversations resolved (automatically enforced)
  • DCO Sign-off

Signed-off-by: chaosinthecrd <[email protected]>
@kairoaraujo kairoaraujo self-assigned this Jan 29, 2025
}

// NOTE: to get the average we need to divide by the number of packages
totalCoverage = totalCoverage / float64(len(a.Packages))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a package is empty would it divide by zero?
Maybe we can avoid it

Suggested change
totalCoverage = totalCoverage / float64(len(a.Packages))
if len(a.Packages) > 0 {
totalCoverage = totalCoverage / float64(len(a.Packages))
} else {
totalCoverage = 0
}

Co-authored-by: Kairo Araujo <[email protected]>
Signed-off-by: Tom Meadows <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants